#include <cstdlib>
#include <iostream>
#include <boost/tuple/tuple.hpp>
#include <boost/function.hpp>

class uniform_random_generator
{
public:
	int operator()(int x) { srand(static_cast<unsigned int>(x)); return rand(); }
};

template<typename F>
int distance(typename F::argument_type x, typename F::argument_type y, F f)
{
	int n = 0;
	while (x!=y) {
		x = f(x);
		++n;
	}
	return n;
}



//boost::tuple<int,int,int>
//	orbit_structure_nonterminating_orbit(int x)
//{
//
//}

int main ()
{
	srand(0);
	std::cout << rand() << std::endl; //38
	std::cout << rand() << std::endl; //7719
	std::cout << rand() << std::endl; //21238

	boost::function<int(int)> f = uniform_random_generator();
	int  n = distance(0,38,f);
	std::cout << n << std::endl;
	//getchar();
}
